﻿package mortal.game.resource
{
    import com.gengine.resource.*;
    import flash.utils.*;
    import frEngine.core.*;

    public class BlendTypeConfig extends Object
    {
        private var _blendTypeList:Dictionary;
        private var _hasInit:Boolean = false;
        public static const instance:BlendTypeConfig = new BlendTypeConfig;

        public function BlendTypeConfig()
        {
            this._blendTypeList = new Dictionary(false);
            return;
        }// end function

        public function init() : void
        {
            var _loc_2:String = null;
            var _loc_3:int = 0;
            var _loc_4:Array = null;
            var _loc_5:int = 0;
            var _loc_6:int = 0;
            var _loc_7:String = null;
            if (this._hasInit)
            {
                return;
            }
            this._hasInit = true;
            var _loc_1:* = ConfigManager.instance.getJSONByFileName("blenType.json");
            for (_loc_2 in _loc_1)
            {
                
                _loc_3 = EBlendType[_loc_2];
                _loc_4 = _loc_1[_loc_2];
                _loc_5 = _loc_4.length;
                _loc_6 = 0;
                while (_loc_6 < _loc_5)
                {
                    
                    _loc_7 = _loc_4[_loc_6];
                    this._blendTypeList[_loc_7] = _loc_3;
                    _loc_6++;
                }
            }
            return;
        }// end function

        public function getBlendType(param1:String) : int
        {
            var _loc_2:int = 0;
            if (!param1)
            {
                return EBlendType.BLEND_NONE;
            }
            if (!this._hasInit)
            {
                throw new Error("请先初始化BlendTypeConfig");
            }
            param1 = param1.toLowerCase().replace(/\.jpg|\.png|\.abc""\.jpg|\.png|\.abc/i, "");
            if (this._blendTypeList.hasOwnProperty(param1))
            {
                return this._blendTypeList[param1];
            }
            return EBlendType.BLEND_NONE;
        }// end function

    }
}
